<template>
    <div>
        <div><input type="text" name="sart"  placeholder="mytime1" @click="openPicker" value="" ></div>
        <div>{{starttime| dateFormat}}</div>

<!-- starttime | dateFormat('YYYY.MM.DD HH:mm') -->

        <div><input type="text" name="end" placeholder="mytime2" @click="openPicker" value="" ></div>
        <div>{{endtime | dateFormat}}</div>


        <div>          
            <mt-datetime-picker
                ref="picker"
                type="datetime"
                v-model="pickerValue"
                @confirm="handleConfirm">
            </mt-datetime-picker>
        </div>


    </div>
</template>

<script>
  export default {
      data(){
          return {
              starttime:'',
              endtime:'',
              el:null
          }
      },
    methods: {
      openPicker(event) {
        this.el = event.currentTarget;
        this.$refs.picker.open();
        console.log(this.el);
      },
      handleConfirm(data){
        //   if(this.el.name == 'sart'){
        //       this.starttime = data;
        //   }
        //  if(this.el.name == 'end'){
        //      this.endtime = data;
        //  }
        this.el.value =this.func(data,'YYYY.MM.DD HH:mm');
        console.log(data);
     
      }
    }
  };
</script>
